//  this library.
import 'package:hktk_app/ienum/question/first_type_enum.dart';
import 'package:hktk_app/model/practice/practice_question_model.dart';
import 'package:hktk_app/util/my_util.dart';

/// 试题相关数据
class QuestionDataModel {
  /// 试题对应id
  String id;

  /// 试题题型
  FirstTypeEnum type;

  /// 题干
  List<Stem>? stem;

  /// 选项
  List<OptionModel> optionList;

  /// 答案
  List<String> answer;

  /// 答案加密值
  String? answerBase64;

  /// 解析
  String analysis;

  /// 试题签名
  String sign;

  /// 试题做题相关记录
  RecordModel? record;

  /// 是否收藏
  bool? collect;

  /// 做题次数
  int doingNumber;

  /// 错题次数
  int errorNumber;

  QuestionDataModel({
    required this.id,
    required this.type,
    required this.stem,
    required this.optionList,
    required this.answer,
    this.answerBase64,
    required this.analysis,
    required this.sign,
    this.record,
    this.collect,
    required this.doingNumber,
    required this.errorNumber,
  });

  /// 获取题干字符串
  String getStemStr() {
    return MyUtil.getStemStr(stem);
  }
}

class OptionModel {
  /// 选项，A,B,C,D
  String option;

  /// 选项内容
  String content;

  OptionModel({
    required this.option,
    required this.content,
  });
}
